Stars

Description

In this project you can see the relationship between the Magnitude and Temperature of the different stars.
This was programmed using R in R Studio

On the X-axis is Temperature and on the Y-axis is Magnitude.

As most of the stars magnitude increases, the temperature decreases.
Stars with a higher temperature are more blue as cooler stars are more red.

Stellar classification is the classification of stars based on their spectral characteristics.
Most stars are currently classified under the Morgan-Keenan (MK) system using the letters O, B, A, F, G, K, and M, a sequence from the hottest (O type) to the coolest (M type).
The legend easily color codes the different star types. The color does not represent the actual color of the star.


To learn more on Stars click Here

Data

Here is a preview of the Data

Star Magnitude Temp Type
1 Sun 4.8 5840 G
2 SiriusA 1.4 9620 A
3 Canopus -3.1 7400 F
4 Arcturus -0.4 4590 K
5 AlphaCentauriA 4.3 5840 G
6 Vega 0.5 9900 A
7 Capella -0.6 5150 G
8 Rigel -7.2 12140 B
9 ProcyonA 2.6 6580 F
10 Betelgeuse -5.7 3200 M

View the full dataset Here


Download the full dataset Here

Code

library(tidyverse)
library(dslabs)
data(stars)
options(digits = 3) # report 3 significant digits

stars %>%
ggplot(aes(temp, magnitude, color = type)) +
geom_point() +
scale_x_reverse() +
scale_y_reverse() +
xlab("Temperature") +
ylab("Magnitude") +
geom_text(aes(label = star), check_overlap = TRUE, vjust = -1, size = 3, color = 'black')

Visuals